package com.sdygmedia.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sdygmedia.dao.PageDao;
import com.sdygmedia.domain.Page;
import com.sdygmedia.service.PageService;

@Service
@Transactional
public class PageServiceImpl implements PageService {

	@Resource
	private PageDao pageDao;
	
	@Override
	public List<Page> findAll() {
		// TODO Auto-generated method stub
		return pageDao.findAll();
	}

	@Override
	public void delete(long id) {
		// TODO Auto-generated method stub
		pageDao.delete(id);
	}

	@Override
	public void save(Page page) {
		// TODO Auto-generated method stub
		//添加管理员的时间
		page.setDate(new Date());
		
		pageDao.save(page);
	}

	@Override
	public Page getById(long id) {
		// TODO Auto-generated method stub
		return pageDao.getById(id);
	}

	@Override
	public void update(Page page) {
		// TODO Auto-generated method stub
		page.setDate(new Date());
		pageDao.update(page);
	}

	
	
}
